﻿namespace NumericalSolution {
  class Convection1DUpWind : Convection1D {
    public override double[] Next() {
      base.Age();

      p_next_u[0] = 0.0;
      for (int i = 1; i < p_numberOfNodes - 1; i++) {
        double nu = a(i * p_deltaX, p_currentTime) 
                      * p_deltaTime / p_deltaX;
        p_next_u[i] = p_current_u[i] 
                      - nu * (p_current_u[i] - p_current_u[i - 1]); 
      }
      p_next_u[p_numberOfNodes - 1] = 0.0;
      p_currentTime += p_deltaTime;
      return p_next_u;
    }
  }
}
